import { FEvent } from "../Event/FEvent";
import { EventDispather } from "../Support/EventDispather";
import { ModuleEvent } from "../Event/ModuleEvent";


export class EventManager
{
    private static dispather:EventDispather = new EventDispather();
    public static addEvent(obj:any,type:string,fun:Function):void
    {
        this.dispather.addEvent(obj,type,fun);
    }
    public static removeEvent(obj:any,type?:string,fun?:Function):void
    {
        this.dispather.removeEvent(obj,type,fun);
    }
    public static dispatchEventWith(type:string,data?:any):void
    {
        this.dispatchEvent(new FEvent(type,data));
    }
    public static dispatchEvent(evt:FEvent):void
    {
        this.dispather.dispatchEvent(evt);
    }
    public static dispatchModuleEventWith(type:string,moduleName:string,gameLayer?:any,data?:any):void
    {
        this.dispatchEvent(new ModuleEvent(type,moduleName,null,gameLayer,data));
    }
}